package adminlte.model;

import lombok.Data;
import org.springframework.security.core.GrantedAuthority;
import org.springframework.security.core.userdetails.UserDetails;

import java.util.Collection;

/**
 * 账户
 * @author ZHUFEIFEI
 */
@Data
public class SysUserAuthentication implements UserDetails {

    private Long id;
    private String username;
    private String password;
    /**
     * 账户不过期
     */
    private boolean accountNonExpired;
    /**
     * 账户不锁定
     */
    private boolean accountNonLocked;
    /**
     * 凭证不过期
     */
    private boolean credentialsNonExpired;
    /**
     * 启用
     */
    private boolean enabled;
    /**
     * 权限列表
     */
    private Collection<GrantedAuthority> authorities;


    @Override
    public Collection<? extends GrantedAuthority> getAuthorities() {
        return this.authorities;
    }

    @Override
    public String getPassword() {
        return this.password;
    }

    @Override
    public String getUsername() {
        return this.username;
    }

    @Override
    public boolean isAccountNonExpired() {
        return this.accountNonExpired;
    }

    @Override
    public boolean isAccountNonLocked() {
        return this.accountNonLocked;
    }

    @Override
    public boolean isCredentialsNonExpired() {
        return this.credentialsNonExpired;
    }

    @Override
    public boolean isEnabled() {
        return this.enabled;
    }
}
